package com.zhongshu.service.impl;

import com.zhongshu.common.response.Query;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhongshu.common.response.PageUtils;
import com.zhongshu.dao.TUserDao;
import com.zhongshu.entity.TUserEntity;
import com.zhongshu.service.TUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Slf4j
@Service("tUserService")
public class TUserServiceImpl extends ServiceImpl<TUserDao, TUserEntity> implements TUserService {

    @Autowired
    private TUserDao tUserDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<TUserEntity> page = this.page(
                new Query<TUserEntity>().getPage(params),
                new QueryWrapper<TUserEntity>()
        );

        return new PageUtils(page);
    }


    @Cacheable(value = "userAll",key = "#root.methodName")
    @Override
    public List<TUserEntity> findAll() {
        log.info("查询了数据库！！");
        return baseMapper.selectList(null);
    }


}